<!DOCTYPE html>
<html>
<head>
    {include file="layout:_meta" /}
    <style type="text/css">
        .layui-layedit-iframe{
            background: white;
            height: 450px;
        }
        .layui-layedit{
            background: white;
        }
    </style>
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding:10px 30px;">

                <div class="layui-form-item">
                    <label class="layui-form-label">类型名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="name"  placeholder="请输入商品名称" lay-verify="required"  value="{:isset($list.name)?$list.name:''}" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">描述</label>
                    <div class="layui-input-block">
                        <textarea name="description" lay-verify="" placeholder="请输入描述" autocomplete="off" class="layui-textarea">{:isset($list.description)?$list.description:''}</textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">序号</label>
                    <div class="layui-input-block">
                        <input type="number" name="sort" lay-verify="" placeholder="请输入序号 数字越小排序越靠前" lay-reqtext=""  autocomplete="off" value="{:isset($list.sort)?$list.sort:''}" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        {if condition="isset($list.state)&&$list.state==1"}
                        <input type="checkbox" lay-filter="state"  checked value="1" name="state" lay-skin="switch" lay-text="启用|禁用">
                        {else /}
                        <input type="checkbox" lay-filter="state"  value="0" name="state" lay-skin="switch" lay-text="启用|禁用">
                        {/if}
                    </div>
                </div>

    <div class="layui-form-item layui-hide">
        <input type="hidden" name="id" value="{:isset($list['id'])?$list['id']:''}">
        <input type="hidden" name="token" value="{:isset($list['token'])?$list['token']:''}">
        <input type="button" lay-submit lay-filter="addEdit" id="addEdit" value="确认">
    </div>
</div>
{include file="layout:_footer" /}
<script src="__static__/admin/lib/jquery/1.9.1/jquery.js"></script>
<script>
    layui.config({
        base: '__static__/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form','upload','layedit'], function(){
        var form = layui.form,$ = layui.$;


        form.on('switch(state)', function(data){
            this.value = this.checked?1:0;
        });
    });
</script>
</body>
</html>